package me.zk.practice1.hw;

import java.util.Scanner;

/**
 * @author zhangkai
 * @date 2023/8/9 17:36
 */
public class HWBJ57 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String[] words = scanner.nextLine().split(",");

        int[] mark = new int[words.length];
        int max = 0;
        for (int i = 0; i < words.length; i++) {
            int t = 0;
            for (int j = 0; j < words[i].length(); j++) {
                int a = words[i].charAt(j)-'a';
                t|=1<<a;
            }
            mark[i]=t;
        }
        for (int i = 0; i < mark.length-1; i++) {
            for (int j = i+1; j < mark.length; j++) {
                if ((mark[i] &mark[j]) ==0) {
                    max = Math.max(max,words[i].length()*words[j].length());
                }
            }
        }
        System.out.println(max);

    }
}
